import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'
const StoreListKey = 'StoreList'
const CurStoreKey = 'CurStore'
const StoreHouseListKey = 'StoreHouseList'
const CategoryDataKey = 'CategoryData'
const DictDataKey = 'DictData'
const DictDetailsDataKey = 'DictDetailsData'

// 登录token
export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

// 门店；
export function getStoreListData() {
  return Cookies.get(StoreListKey)
}

export function setStoreList(data) {
  return Cookies.set(StoreListKey, data)
}

export function removeStoreList() {
  return Cookies.remove(StoreListKey)
}
// 当前门店
export function getCurStore() {
  return Cookies.get(CurStoreKey)
}

export function setCurStore(data) {
  return Cookies.set(CurStoreKey, data)
}

export function removeCurStore() {
  return Cookies.remove(CurStoreKey)
}

// 仓库；
export function getStoreHouseListData() {
  return Cookies.get(StoreHouseListKey)
}

export function setStoreHouseList(data) {
  return Cookies.set(StoreHouseListKey, data)
}

export function removeStoreHouseList() {
  return Cookies.remove(StoreHouseListKey)
}

// 商品分类
export function getCategoryData() {
  return Cookies.get(CategoryDataKey)
}

export function setCategoryData(data) {
  return Cookies.set(CategoryDataKey, data)
}

export function removeCategoryData() {
  return Cookies.remove(CategoryDataKey)
}

// 字典列表
export function getDictData() {
  return sessionStorage.getItem(DictDataKey);
}

export function setDictData(data) {
  console.log('setDictData--data==', data);
  return sessionStorage.setItem(DictDataKey, data);
}

export function removeDictData() {
  return Cookies.remove(DictDataKey)
}
// 字典详情
export function getDictDetailsData() {
  return Cookies.get(DictDetailsDataKey)
}

export function setDictDetailsData(data) {
  return Cookies.set(DictDetailsDataKey, data)
}

export function removeDictDetailsData() {
  return Cookies.remove(DictDetailsDataKey)
}
